﻿#include "FITKAbaOutputDefaultVariablesManager.h"
#include <QMetaEnum>


namespace Interface {

void FITKAbaOutputDefaultVariablesManager::initPreHistory()
{
    QMetaEnum m = QMetaEnum::fromType<FITKAbaOutputVariable::OutputVariable>();
    bool ok{false};
    const QStringList staticWhole{"ALLAE","ALLCD","ALLDMD","ALLEE","ALLFD","ALLIE","ALLJD","ALLKE",
                                 "ALLKL","ALLPD","ALLQB","ALLSD","ALLSE","ALLVD","ALLWK","ETOTAL"};
    for (auto& var : staticWhole)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_preselectedHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::GeneralStatic][FITKAbaOutputVariable::OutputDomain::WholeModel].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList staticSet{"ALLAE","ALLCD","ALLDMD","ALLEE","ALLFD","ALLIE","ALLJD","ALLKE",
                                "ALLKL","ALLPD","ALLQB","ALLSD","ALLSE","ALLVD","ALLWK","ETOTAL"};
    for (auto& var : staticSet)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_preselectedHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::GeneralStatic][FITKAbaOutputVariable::OutputDomain::Set].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList staticInteraction{};
    for (auto& var : staticInteraction)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_preselectedHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::GeneralStatic][FITKAbaOutputVariable::OutputDomain::Interaction].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList expWhole{"ALLAE","ALLCD","ALLDMD","ALLFD","ALLIE","ALLKE","ALLPD","ALLSE","ALLVD","ALLWK","ETOTAL"};
    for (auto& var : expWhole)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_preselectedHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::DynamicExplicit][FITKAbaOutputVariable::OutputDomain::WholeModel].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList expSet{"ALLAE","ALLCD","ALLDMD","ALLFD","ALLIE","ALLKE","ALLPD","ALLSE","ALLVD","ALLWK","ETOTAL"};
    for (auto& var : expSet)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_preselectedHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::DynamicExplicit][FITKAbaOutputVariable::OutputDomain::Set].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList expInterac{};
    for (auto& var : expInterac)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_preselectedHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::DynamicExplicit][FITKAbaOutputVariable::OutputDomain::Interaction].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
}

void FITKAbaOutputDefaultVariablesManager::initAllHistory()
{
    QMetaEnum m = QMetaEnum::fromType<FITKAbaOutputVariable::OutputVariable>();
    bool ok{false};
    const QStringList staticWhole{"IRA1","IRA2","IRA3","IRAR1","IRAR2","IRAR3","IRF1","IRF2","IRF3","IRM1","IRM2","IRM3","CSTRESS","CDSTRESS","CDISP","CFNM",
                                  "CFN1","CFN2","CFN3","CFSM","CFS1","CFS2","CFS3","CFTM","CFT1","CFT2","CFT3","CICPS","CMNM","CMN1","CMN2","CMN3","CMSM",
                                  "CMS1","CMS2","CMS3","CMTM","CMT1","CMT2","CMT3","CAREA","CTRQ","XN1","XN2","XN3","XS1","XS2","XS3","XT1","XT2","XT3",
                                  "PPRESS","ALLAE","ALLCD","ALLDMD","ALLEE","ALLFD","ALLIE","ALLJD","ALLKE","ALLKL","ALLPD","ALLQB","ALLSE","ALLSD","ALLVD",
                                  "ALLWK","ETOTAL","DBS11","DBS12","DBT","DBSF","OPENBC","CRSTS11","CRSTS12","CRSTS13","ENRRT11","ENRRT12","ENRRT13","EFENRRTR",
                                  "BDSTAT","CSDMG","CSMAXSCRT","CSMAXUCRT","CSQUADSCRT","CSQUADUCRT","SJD","SJDA","SJDT","SJDTA","ECD1","ECD2","ECD3","ECDM",
                                  "ECDA","ECDT","ECDTA","IRX1","IRX2","IRX3","IRRI11","IRRI22","IRRI33","IRRI12","IRRI13","IRRI23","IRMASS","MASS"};
    for (auto& var : staticWhole)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_allHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::GeneralStatic][FITKAbaOutputVariable::OutputDomain::WholeModel].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList staticSet{"S11","S22","S33","S12","S13","S23","SP","TRESC","PRESS","INV3","MISES","TSHR13","TSHR23","CTSHR13","CTSHR23","ALPHA11","ALPHA22",
            "ALPHA33","ALPHA12","ALPHA13","ALPHA23","ALPHAP","TRIAX","VS11","VS22","VS33","VS12","VS13","VS23","PS11","PS22","PS33","PS12","PS13","PS23","CS11",
            "ALPHA1","ALPHA2","ALPHA3","ALPHA4","ALPHA5","ALPHA6","ALPHA7","ALPHA8","ALPHA9","ALPHA10","SSAVG1","SSAVG2","SSAVG3","SSAVG4","SSAVG5","SSAVG6","SEQUT",
            "YIELDPOT","E11","E22","E33","E12","E13","E23","EP","VE11","VE22","VE33","VE12","VE13","VE23","PE11","PE22","PE33","PE12","PE13","PE23","PEP","VEEQ",
            "PEEQ","PEEQT","PEMAG","PEQC1","PEQC2","PEQC3","PEQC4","EE11","EE22","EE33","EE12","EE13","EE23","EEP","IE11","IE22","IE33","IE12","IE13","IE23","IEP",
            "THE11","THE22","THE33","THE12","THE13","THE23","THEP","NE11","NE22","NE33","NE12","NE13","NE23","NEP","LE11","LE22","LE33","LE12","LE13","LE23","LEP",
            "TE11","TE22","TE33","TE12","TE13","TE23","TEEQ","TEVOL","EEQUT","ER11","ER22","ER33","ER12","ER13","ER23","ERP","SE1","SE2","SE3","SK1","SK2","SK3",
            "BICURV","SPE1","SPE2","SPE3","SPE4","SEPE1","SEPE2","SEPE3","SEPE4","SEE1","SKE1","SKE2","SKE3","SEP1","SKP1","SKP2","SKP3","SALPHA1","SALPHA2","SALPHA3",
            "SALPHA4","U1","U2","U3","UR1","UR2","UR3","UT","UR","V1","V2","V3","VR1","VR2","VR3","VT","VR","WARP","RBANG","RBROT","IRA1","IRA2","IRA3","IRAR1","IRAR2",
            "IRAR3","RF1","RF2","RF3","RM1","RM2","RM3","RT","RM","RWM","CF1","CF2","CF3","CM1","CM2","CM3","CW","SF1","SF2","SF3","SM1","SM2","SM3","BIMOM","TF1","TF2",
            "TF3","TM1","TM2","TM3","VF1","VF2","VF3","VM1","VM2","VM3","ESF1","NFORC","NFORCSO","RBFOR","IRF1","IRF2","IRF3","IRM1","IRM2","IRM3","CSTRESS","CDSTRESS",
            "CDISP","CFNM","CFN1","CFN2","CFN3","CFSM","CFS1","CFS2","CFS3","CFTM","CFT1","CFT2","CFT3","CICPS","CMNM","CMN1","CMN2","CMN3","CMSM","CMS1","CMS2","CMS3",
            "CMTM","CMT1","CMT2","CMT3","CAREA","CTRQ","XN1","XN2","XN3","XS1","XS2","XS3","XT1","XT2","XT3","PPRESS","CTF1","CTF2","CTF3","CTM1","CTM2","CTM3","CEF1",
            "CEF2","CEF3","CEM1","CEM2","CEM3","CVF1","CVF2","CVF3","CVM1","CVM2","CVM3","CSF1","CSF2","CSF3","CSM1","CSM2","CSM3","CSFC","CNF1","CNF2","CNF3","CNM1",
            "CNM2","CNM3","CNFC","CDMG1","CDMG2","CDMG3","CDMGR1","CDMGR2","CDMGR3","CDIF1","CDIF2","CDIF3","CDIFR1","CDIFR2","CDIFR3","CDIFC","CDIM1","CDIM2","CDIM3",
            "CDIMR1","CDIMR2","CDIMR3","CDIMC","CDIP1","CDIP2","CDIP3","CDIPR1","CDIPR2","CDIPR3","CDIPC","CSLST1","CSLST2","CSLST3","CSLST4","CSLST5","CSLST6","CASU1",
            "CASU2","CASU3","CASUR1","CASUR2","CASUR3","CASUC","CIVC","CRF1","CRF2","CRF3","CRM1","CRM2","CRM3","CCF1","CCF2","CCF3","CCM1","CCM2","CCM3","CP1","CP2",
            "CP3","CPR1","CPR2","CPR3","CU1","CU2","CU3","CUR1","CUR2","CUR3","CUE1","CUE2","CUE3","CURE1","CURE2","CURE3","CUP1","CUP2","CUP3","CURP1","CURP2","CURP3",
            "CUPEQ1","CUPEQ2","CUPEQ3","CURPEQ1","CURPEQ2","CURPEQ3","CUPEQC","CALPHAF1","CALPHAF2","CALPHAF3","CALPHAM1","CALPHAM2","CALPHAM3","CCU1","CCU2","CCU3",
            "CCUR1","CCUR2","CCUR3","CV1","CV2","CV3","CVR1","CVR2","CVR3","CA1","CA2","CA3","CAR1","CAR2","CAR3","CFAILST1","CFAILST2","CFAILST3","CFAILST4","CFAILST5",
            "CFAILST6","SENER","PENER","EENER","JENER","ELKE","ELSE","ELPD","ELSD","ELCTE","ELJD","ELASE","ELDMD","ELIHE","EKEDEN","EPDDEN","ECDDEN","EVDDEN","ESDDEN",
            "ECTEDEN","EASEDEN","EDMDDEN","ALLAE","ALLCD","ALLDMD","ALLEE","ALLFD","ALLIE","ALLJD","ALLKE","ALLKL","ALLPD","ALLQB","ALLSE","ALLSD","ALLVD","ALLWK","ETOTAL",
            "DAMAGEC","DAMAGET","DAMAGEFT","DAMAGEFC","DAMAGEMT","DAMAGEMC","DAMAGESHR","SDEG","JK","MSTRS","TSAIH","TSAIW","AZZIT","MSTRN","DBS11","DBS12","DBT","DBSF",
            "OPENBC","CRSTS11","CRSTS12","CRSTS13","ENRRT11","ENRRT12","ENRRT13","EFENRRTR","BDSTAT","MAXSCRT","MAXECRT","QUADSCRT","QUADECRT","HSNFTCRT","HSNFCCRT",
            "HSNMTCRT","HSNMCCRT","MSFLDCRT","ERPRATIO","SHRRATIO","CSDMG","CSMAXSCRT","CSMAXUCRT","CSQUADSCRT","CSQUADUCRT","PHILSM","PSILSM","ENRRTXFEM11","ENRRTXFEM22",
            "ENRRTXFEM33","NT","TEMP","SJD","SJDA","SJDT","SJDTA","EPOT","EPG1","EPG2","EPG3","EPGM","RCHG","CECHG","RECUR","CECUR","ECD1","ECD2","ECD3","ECDM","ECDA",
            "ECDT","ECDTA","EFLX1","EFLX2","EFLX3","EFLXM","NCURS","VVF","VVFG","VVFN","RD","PCAV","MFL1","MFL2","MFL3","MFLM","MFLT","VOL","CVOL","SVOL","EVOL","ESOL",
            "IVOL","VOLC","STH","COOR1","COOR2","COOR3","IRX1","IRX2","IRX3","IRRI11","IRRI22","IRRI33","IRRI12","IRRI13","IRRI23","IRMASS","MASS","XC1","XC2","XC3","UC1",
            "UC2","UC3","URC1","URC2","URC3","RI11","RI22","RI33","RI12","RI13","RI23","SDV","ESDV","FV","MFR","UVARM","STATUS","EACTIVE","STATUSXFEM","LOADSXFEM","MVF"};
    for (auto& var : staticSet)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_allHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::GeneralStatic][FITKAbaOutputVariable::OutputDomain::Set].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList staticInteraction{"CSTRESS","CDSTRESS","CDISP","CFNM","CFN1","CFN2","CFN3","CFSM","CFS1","CFS2","CFS3","CFTM","CFT1","CFT2","CFT3","CICPS","CMNM",
                                        "CMN1","CMN2","CMN3","CMSM","CMS1","CMS2","CMS3","CMTM","CMT1","CMT2","CMT3","CAREA","CTRQ","XN1","XN2","XN3","XS1","XS2","XS3",
                                        "XT1","XT2","XT3","PPRESS","DBS11","DBS12","DBT","DBSF","OPENBC","CRSTS11","CRSTS12","CRSTS13","ENRRT11","ENRRT12","ENRRT13",
                                        "EFENRRTR","BDSTAT","CSDMG","CSMAXSCRT","CSMAXUCRT","CSQUADSCRT","CSQUADUCRT","SJD","SJDA","SJDT","SJDTA","ECD1","ECD2","ECD3",
                                        "ECDM","ECDA","ECDT","ECDTA"};
    for (auto& var : staticInteraction)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_allHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::GeneralStatic][FITKAbaOutputVariable::OutputDomain::Interaction].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList expWhole{"CDISP","CFNM","CFN1","CFN2","CFN3","CFSM","CFS1","CFS2","CFS3","CFTM","CFT1","CFT2","CFT3","CICPS","CMNM","CMN1","CMN2","CMN3","CMSM",
                               "CMS1","CMS2","CMS3","CMTM","CMT1","CMT2","CMT3","CAREA","CTRQ","XN1","XN2","XN3","XS1","XS2","XS3","XT1","XT2","XT3","PPRESS","ALLAE",
                               "ALLCD","ALLDC","ALLDMD","ALLFD","ALLIE","ALLKE","ALLPD","ALLSE","ALLVD","ALLWK","ALLCW","ALLMW","ALLPW","ETOTAL","DT","DMASS"};
    for (auto& var : expWhole)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_allHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::DynamicExplicit][FITKAbaOutputVariable::OutputDomain::WholeModel].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList expSet{"S11","S22","S33","S12","S13","S23","SP","TRESC","PRESS","INV3","MISES","TSHR13","TSHR23","CTSHR13","CTSHR23","TRIAX","VS11","VS22",
                             "VS33","VS12","VS13","VS23","PS11","PS22","PS33","PS12","PS13","PS23","SFABRIC11","SFABRIC22","SFABRIC33","SFABRIC12","SFABRIC13",
                             "SFABRIC23","SSAVG1","SSAVG2","SSAVG3","SSAVG4","SSAVG5","SSAVG6","SEQUT","YIELDPOT","E11","E22","E33","E12","E13","E23","VE11","VE22",
                             "VE33","VE12","VE13","VE23","PE11","PE22","PE33","PE12","PE13","PE23","PEP","VEEQ","PEEQ","PEEQT","PEMAG","PEQC1","PEQC2","PEQC3",
                             "PEQC4","NE11","NE22","NE33","NE12","NE13","NE23","NEP","NEEQ","NEEQR","LE11","LE22","LE33","LE12","LE13","LE23","LEP","TE11","TE22",
                             "TE33","TE12","TE13","TE23","TEEQ","TEVOL","EEQUT","ER11","ER22","ER33","ER12","ER13","ER23","ERV","SE1","SE2","SE3","SK1","SK2","SK3",
                             "BICURV","EFABRIC11","EFABRIC22","EFABRIC33","EFABRIC12","EFABRIC13","EFABRIC23","U1","U2","U3","UR1","UR2","UR3","UT","UR","UCOM1",
                             "UCOM2","UCOM3","V1","V2","V3","VR1","VR2","VR3","VT","VR","VCOM1","VCOM2","VCOM3","A1","A2","A3","AR1","AR2","AR3","AT","AR","ACOM1",
                             "ACOM2","ACOM3","RBANG","RBROT","RF1","RF2","RF3","RM1","RM2","RM3","RT","RM","RWM","CF1","CF2","CF3","CM1","CM2","CM3","SF1","SF2","SF3",
                             "SM1","SM2","SM3","NFORC","NFORCSO","RBFOR","CDISP","CFNM","CFN1","CFN2","CFN3","CFSM","CFS1","CFS2","CFS3","CFTM","CFT1","CFT2","CFT3",
                             "CICPS","CMNM","CMN1","CMN2","CMN3","CMSM","CMS1","CMS2","CMS3","CMTM","CMT1","CMT2","CMT3","CAREA","CTRQ","XN1","XN2","XN3","XS1","XS2",
                             "XS3","XT1","XT2","XT3","PPRESS","CTF1","CTF2","CTF3","CTM1","CTM2","CTM3","CEF1","CEF2","CEF3","CEM1","CEM2","CEM3","CVF1","CVF2","CVF3",
                             "CVM1","CVM2","CVM3","CSF1","CSF2","CSF3","CSM1","CSM2","CSM3","CSFC","CNF1","CNF2","CNF3","CNM1","CNM2","CNM3","CNFC","CDMG1","CDMG2",
                             "CDMG3","CDMGR1","CDMGR2","CDMGR3","CDERU","CDERF","CDIF1","CDIF2","CDIF3","CDIFR1","CDIFR2","CDIFR3","CDIFC","CDIM1","CDIM2","CDIM3",
                             "CDIMR1","CDIMR2","CDIMR3","CDIMC","CDIP1","CDIP2","CDIP3","CDIPR1","CDIPR2","CDIPR3","CDIPC","CSLST1","CSLST2","CSLST3","CSLST4","CSLST5",
                             "CSLST6","CASU1","CASU2","CASU3","CASUR1","CASUR2","CASUR3","CASUC","CIVC","CRF1","CRF2","CRF3","CRM1","CRM2","CRM3","CCF1","CCF2","CCF3",
                             "CCM1","CCM2","CCM3","CP1","CP2","CP3","CPR1","CPR2","CPR3","CU1","CU2","CU3","CUR1","CUR2","CUR3","CUE1","CUE2","CUE3","CURE1","CURE2",
                             "CURE3","CUF1","CUF2","CUF3","CUP1","CUP2","CUP3","CURP1","CURP2","CURP3","CUPEQ1","CUPEQ2","CUPEQ3","CURPEQ1","CURPEQ2","CURPEQ3","CUPEQC",
                             "CALPHAF1","CALPHAF2","CALPHAF3","CALPHAM1","CALPHAM2","CALPHAM3","CCU1","CCU2","CCU3","CCUR1","CCUR2","CCUR3","CV1","CV2","CV3","CVR1","CVR2",
                             "CVR3","CA1","CA2","CA3","CAR1","CAR2","CAR3","CFAILST1","CFAILST2","CFAILST3","CFAILST4","CFAILST5","CFAILST6","SENER","PENER","VENER",
                             "DMENER","ELKE","ELSE","ELPD","ELVD","ELASE","ELDMD","ELIHE","ELDC","EKEDEN","EPDDEN","ECDDEN","EVDDEN","ESDDEN","ECTEDEN","EASEDEN","EDMDDEN",
                             "ALLAE","ALLCD","ALLDC","ALLDMD","ALLFD","ALLIE","ALLKE","ALLPD","ALLSE","ALLVD","ALLWK","ALLCW","ALLMW","ALLPW","ETOTAL","EDCDEN","EDT",
                             "DAMAGEC","DAMAGET","DAMAGEFT","DAMAGEFC","DAMAGEMT","DAMAGEMC","DAMAGESHR","SDEG","CFAILURE","MAXSCRT","MAXECRT","QUADSCRT","QUADECRT",
                             "DUCTCRT","SHRCRT","FLDCRT","FLSDCRT","MKCRT","JCCRT","HSNFTCRT","HSNFCCRT","HSNMTCRT","HSNMCCRT","MSFLDCRT","ERPRATIO","SHRRATIO","TEMP",
                             "CTEMP","ACTEMP","TINFL","VVF","VVFG","VVFN","RD","PCAV","APCAV","MFL1","MFL2","MFL3","MFLM","MFLT","CMASS","TCMASS","CMF","CMFL","CMFLT",
                             "CEFL","CEFLT","MINFL","MINFLT","POR","PABS","CVOL","SVOL","EVOL","EVF","ESOL","IVOL","VOLC","STH","COOR1","COOR2","COOR3","CSAREA","CLAREA",
                             "CBLARAT","TCVOL","TCSAREA","COORDCOM1","COORDCOM2","COORDCOM3","VOLEUL","MASS","MASSEUL","SDV","ESDV","FV","MFR","UVARM","DT","DMASS","EMSF",
                             "DENSITY","STATUS","EACTIVE","RHOE","RHOP","BURNF","DBURNF","MVF"};
    for (auto& var : expSet)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_allHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::DynamicExplicit][FITKAbaOutputVariable::OutputDomain::Set].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
    const QStringList expInt{"CDISP","CFNM","CFN1","CFN2","CFN3","CFSM","CFS1","CFS2","CFS3","CFTM","CFT1","CFT2","CFT3","CICPS","CMNM","CMN1","CMN2","CMN3","CMSM",
                             "CMS1","CMS2","CMS3","CMTM","CMT1","CMT2","CMT3","CAREA","CTRQ","XN1","XN2","XN3","XS1","XS2","XS3","XT1","XT2","XT3","PPRESS"};
    for (auto& var : expInt)
    {
        int value = m.keyToValue(var.toLatin1().data(), &ok);
        if (!ok)
            continue;
        m_allHistoryVariables[FITKAbaAbstractStep::FITKAbaStepType::DynamicExplicit][FITKAbaOutputVariable::OutputDomain::Interaction].append(static_cast<FITKAbaOutputVariable::OutputVariable>(value));
    }
}

}
